<admintpl file="header" />
<style type="text/css">
.pic-list li {
	margin-bottom: 5px;
}
.head_img{margin: 0px 20px;float:left}
</style>
</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('index')}">客服消息列表</a></li>
			<li class="active"><a href="#">编辑</a></li>
		</ul>
		<form action="{:U('edit')}" method="post" class="form-horizontal" enctype="multipart/form-data">
			<div class="row-fluid">
				<div class="span9">
					<table class="table table-bordered">
						<tr>
							<th>标题</th>
							<td>
								<input type="hidden" name="post[id]" value="{$info.id}">
								<input type="text" style="width: 400px;" name="post[title]" required value="{$info.title}" placeholder="请输入标题"/>
								<span class="form-required">*</span>
							</td>
						</tr>
						<tr>
							<th>内容</th>
							<td>
								<textarea name="post[content]" id='content' style="width: 98%; height: 165px;" placeholder="">{$info.content}</textarea>
							</td>
						</tr>
						<tr>
							<th>预览</th>
							<td>
								<select name="" id="openid">
									<option value=''>请选择测试人员</option>
									<option value="otEqOv5gIBf_VonFOJAt5JDBaZNk">开发人员</option>
									<option value="{:F('att_base')[admin_wx_openid]}">行政管理员</option>
								</select>
								<a href="javascript:;" id='preview' class='btn btn-primary btn-small'>发送</a>
							</td>
						</tr>

					</table>
				</div>

			</div>
			<div class="form-actions">
				<button class="btn btn-primary ajax-post" target-form='form-horizontal' type='submit'>提交</button>
				<a class="btn" href="{:U('index')}">返回</a>
			</div>
		</form>
	</div>
	<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
	<script>
		$('#preview').click(function(){
			var content = $('#content').val();
			var openid = $('#openid option:selected').val()
 			$.ajax({
				type:'post',
				url:"{:U('preview')}",
				data:{'openid':openid,'content':content},
				success:function(data){
					if (data.status == 1){
                        updateAlert(data.info ,'alert-success');
                    setTimeout(function(){
                        $(that).removeClass('disabled').prop('disabled',false);
                    },1500);						
					}else{
                        updateAlert(data.info,'alert-danger');
					}
				}
			}) 
		})
	
	</script>
</body>
</html>